package com.niji.littly_donkey_android.util;

import java.io.File;
import java.text.SimpleDateFormat; 
import java.util.Date; 
 
import android.os.Environment; 
 
public class FormatUtil { 
 
 /** 
  * 将缓存文件夹的数据转存到vedio文件下 
  * @param recAudioFile 
  */ 
 public static void videoRename(File recAudioFile) { 
  String path = Environment.getExternalStorageDirectory() 
    .getAbsolutePath()+ "/mahc/video/"+ "0" + "/"; 
  String fileName = new SimpleDateFormat("yyyyMMddHHmmss") 
    .format(new Date()) + ".3gp"; 
  File out = new File(path); 
  if (!out.exists()) { 
   out.mkdirs(); 
  } 
  out = new File(path, fileName); 
  if (recAudioFile.exists()) 
   recAudioFile.renameTo(out); 
 } 
  
 /** 
  * 用以计时操作的相关方法 
  * @param num 
  * @return 
  */ 
 public static String format(int num){ 
  String s = num + ""; 
  if (s.length() == 1) { 
   s = "0" + s; 
  } 
  return s; 
 } 
} 